# Maintainer: kpcyrd <kpcyrd[at]archlinux[dot]org>

pkgname=updlockfiles
pkgver=0.1.0
pkgrel=1
pkgdesc="Manage lockfiles in PKGBUILDs for upstreams that don't ship them"
url="https://github.com/kpcyrd/updlockfiles"
arch=('loong64' 'x86_64')
license=('GPL-3.0-or-later')
depends=('pacman-contrib')
makedepends=('cargo')
source=(https://github.com/kpcyrd/${pkgname}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
b2sums=('913e92e5b5ce1a1f0d1bca5947b0fe740076f529782cb724a9e8bc1b2288d576c775187e19fd625916009446b3c508979cdac123485c1e6cada066293f771839')

prepare() {
  cd "${pkgname}-${pkgver}"
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
  cd ${pkgname}-${pkgver}
  cargo build --frozen --release
}

check() {
  cd ${pkgname}-${pkgver}
  cargo test --frozen
}

package() {
  cd ${pkgname}-${pkgver}
  install -Dm 755 target/release/${pkgname} "${pkgdir}/usr/bin/${pkgname}"

  install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
